package com.qiaoanju.hystrix;

import com.qiaoanju.domain.UserDomain;
import com.qiaoanju.feign.UserFeignClient;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class HystrixUserClientFallback implements UserFeignClient {

    @Override
    public UserDomain findById(Long id) {
        UserDomain user = new UserDomain();
        user.setId(1L);
        user.setUsername("use Fallback");
        user.setPassword("findById");
        return user;
    }

    @Override
    public UserDomain postUser(UserDomain user) {
        user.setId(2L);
        user.setUsername("use Fallback");
        user.setPassword("postUser");
        return user;
    }

    @Override
    public UserDomain login(Map<String, Object> map) {
        UserDomain user = new UserDomain();
        user.setId(3L);
        user.setUsername("use Fallback");
        user.setPassword("login");
        return user;
    }
}
